import os

os.environ["DASHSCOPE_API_KEY"] = 'sk-965dc39b016c49ecbe29de180f4db2b6'
from langchain_community.llms import Tongyi
# from langchain.chains import
from langchain.prompts import PromptTemplate

llm = Tongyi(temperature=0.3)
res = llm('你是谁？')  #调用对象的__call__方法，返回对象的类型是字符串
# print(res)
res = llm.predict('你是谁？')
# print(res)
res = llm.generate(
    ['请给我讲一个笑话','请给我讲一个故事']
)
for data in res.generations:
    print(data)
    print(data[0].text)